#ifndef CIMAGEDECODERPROCESS_H_
#define CIMAGEDECODERPROCESS_H_

#include <e32base.h>
#include <ImageConversion.h>

class TFrame;
class MImageLoadedNotify
{
public:
	virtual TDesC& GetFileName() = 0;
	virtual RArray<TFrame>* GetFrames() = 0;
	virtual void LoadedCompleteNotify() = 0;
};

class TFrame
{
public:
	CFbsBitmap* iBitmap;
	CFbsBitmap* iBitmapMask;
	TUint32 iFlags;
	TPoint iPosition;
	TSize iSize;
	TRgb iBackColor;
	TTimeIntervalMicroSeconds iDelay;
	TBool iConverted;
	
	inline TFrame();
};

inline TFrame::TFrame() 
{
	iBitmap = NULL;
	iBitmapMask = NULL;
	iFlags = 0;
	iPosition = TPoint(0,0);
	iSize = TSize(0,0);
	iBackColor = KRgbWhite;
	iDelay = 0;
	iConverted = EFalse;
}

class CImageDecoderProcess : public CActive
{
public:
	static CImageDecoderProcess* NewL(MImageLoadedNotify* aImageLoadedNotify);
	virtual ~CImageDecoderProcess();
	
protected:
	CImageDecoderProcess();
	void ConstructL(MImageLoadedNotify* aImageLoadedNotify);
	void ConvertL();
protected:
	void RunL();
	TInt RunError(TInt aError);
	void DoCancel();

private:
	TInt iResolvingFrame;
	CImageDecoder* iDecoder;
//	RArray<TFrame>* iFrameArray;
	MImageLoadedNotify* iImageLoadedNotify;
};

#endif /*CIMAGEDECODERPROCESS_H_*/
